Everything Totally Explained


Ask & we'll explain, totally!
Halting problem
Totally Explained


  NEW! All the latest news in the worlds of computer gaming, entertainment, the environment,  
finance, health, politics, science, stocks & shares, technology and much, much, more.  


View this entry using RSS

Everything about Halt Problem totally explained

In computability theory, the halting problem is a decision problem which can be stated as follows: » Given a description of a program and a finite input, decide whether the program finishes running or will run forever, given that input.

Alan Turing proved in 1936 that a general algorithm to solve the halting problem for all possible program-input pairs can't exist. We say that the halting problem is undecidable over Turing machines. Copeland (2004) attributes the actual term halting problem to Martin Davis.

Formal statement

The halting problem is a decision problem about properties of computer programs on a fixed Turing-complete model of computation. The question is, given a program and an input to the program, whether the program will eventually halt when run with that input. In this abstract framework, there are no resource limitations of memory or time on the program's execution; it can take arbitrarily long, and use arbitrarily much storage space, before halting. The question is simply whether the given program will ever halt on a particular input.
   For example, the C program int main(void) return This program searches until it finds an odd perfect number, then halts. It halts if and only if such a number exists, which is a major open question in mathematics. So, after centuries of work, mathematicians have yet to discover whether a simple, ten-line program halts. This makes it difficult to see how humans could solve the halting problem.
   More generally, it's usually easy to see how to write a simple brute-force search program that looks for counterexamples to any particular conjecture in number theory; if the program finds a counterexample, it stops and prints out the counterexample, and otherwise it keeps searching forever. For example, consider the famous (and still unsolved) twin prime conjecture. This asks whether there are arbitrarily large prime numbers p and q with p+2 = q. Now consider the following program, which accepts an input N:
function findTwinPrimeAbove(int N) int p = N loop if p is prime and p + 2 is prime then return else p = p + 1
   This program searches for twin primes p and p+2 both at least as large as N. If there are arbitrarily large twin primes, it'll halt for all possible inputs. But if there's a largest pair of twin primes P and P+2, then the program will never halt if it's given an input N larger than P. Thus if we could answer the question of whether this program halts on all inputs, we'd have the long-sought answer to the twin prime conjecture. It's similarly straightforward to write programs which halt depending on the truth or falsehood for many other conjectures of number theory.
   Because of this, one might say that the unsolvability of the halting problem is unsurprising. If there were a mechanical way to decide whether arbitrary programs would halt, then many apparently difficult mathematical problems would succumb to it. A counterargument to this, however, is that even if the halting problem were decidable over Turing machines, as it's over physical computers and other LBAs, it might still be infeasible in practice because it takes too much time or memory to execute. For example, there are some very large upper bounds on numbers with certain properties in number theory (the predominant example of this being Graham's number), but it's not feasible to check all values below this bound in a naïve way with a computer — they can't even hold some of these numbers in memory.

Recognizing partial solutions

There are many programs that either return a correct answer to the halting problem or don't return an answer at all. If it were possible to decide whether a program gives only correct answers, one might hope to collect a large number of such programs and run them in parallel, in the hope of being able to determine whether any programs halt. However, recognizing such partial halting solvers (PHS) is just as hard as the halting problem itself.
   Suppose someone claims that program PHSR is a partial halting solver recognizer. Construct a program H:
input a program P X := "input Q. if Q = P output 'halts' else loop forever" run PHSR with X as input
   If PHSR recognizes the constructed program X as a partial halting solver, that means that P, the only input for which X produces a result, halts. If PHSR fails to recognize X, then it must be because P doesn't halt. Therefore H can decide whether an arbitrary program P halts; it solves the halting problem. Since this is impossible, the program PHSR couldn't have been a partial halting solver recognizer as claimed. Therefore no program can be a partial halting solver recognizer.
   Another example, HT, of a Turing machine which gives correct answers only for some instances of the halting problem can be described by the requirements that, if HT is started scanning a field which carries the first of a finite string of a consecutive "1"s, followed by one field with symbol "0" (i. e. a blank field), and followed in turn by a finite string of i consecutive "1"s, on an otherwise blank tape, then
  • HT halts for any such starting state, i. e. for any input of finite positive integers a and i;
  • HT halts on a completely blank tape if and only if the Turing machine represented by a doesn't halt when given the starting state and input represented by i; and
  • HT halts on a nonblank tape, scanning an appropriate field (which however doesn't necessarily carry the symbol "1") if and only if the Turing machine represented by a does halt when given the starting state and input represented by i. In this case, the final state in which HT halted (contents of the tape, and field being scanned) shall be equal to some particular intermediate state which the Turing machine represented by a attains when given the starting state and input represented by i; or, if all those intermediate states (including the starting state represented by i) leave the tape blank, then the final state in which HT halted shall be scanning a "1" on an otherwise blank tape. While its existence hasn't been refuted (essentially: because there's no Turing machine which would halt only if started on a blank tape), such a Turing machine HT would solve the halting problem only partially either (because it doesn't necessarily scan the symbol "1" in the final state, if the Turing machine represented by a does halt when given the starting state and input represented by i, as explicit statements of the halting problem for Turing machines may require).

    History of the halting problem

    In the following: U refers to the source Davis, 1965. » For more see .

    1900 -- Hilbert poses his "23 questions" cf Hilbert problems at the Second International Congress of Mathematicians in Paris, "Of these, the second was that of proving the consistency of the 'Peano axioms' on which, as he'd shown, the rigour of mathematics depended" (Hodges p. 83, Davis' commentary in U p. 108).
       1928 -- Hilbert recasts his 'Second Problem' at the Bologna International Congress (cf Reid pp. 188-189). Hodges claims he posed three questions: for example #1: Was mathematics complete? #2: Was mathematics consistent? #3: Was mathematics decidable? (Hodges p. 91). The third question is known as the Entscheidungsproblem (Decision Problem) (Hodges p. 91, Penrose p. 34)
       1930 -- Gödel announces a proof as an answer to the first two of Hilbert's 1928 questions [cfReid p. 198]. "At first he [Hilbert] was only angry and frustrated, but then he began to try to deal constructively with the problem... Gödel himself felt -- and expressed the thought in his paper -- that his work didn't contradict Hilbert's formalistic point of view" (Reid p. 199).
       1931 -- The paper of Kurt Gödel appears: "On Formally Undecidable Propositions of Principia Mathematica and Related Systems I", (reprinted in U p. 5ff) 19 April 1935 -- Paper of Alonzo Church "An Unsolvable Problem of Elementary Number Theory" identifies what it means for a function to effective calculable. Such a function will have an algorithm, and "...the fact that the algorithm has terminated becomes effectively known ..." (italics added, U p. 100).
       1936 -- Alonzo Church publishes the first proof that the Entscheidungsproblem is unsolvable [ANote on the Entscheidungsproblem, reprinted in U p. 110].
       7 October 1936 -- Emil Post's paper "Finite Combinatory Processes. Formulation I" is received. Post adds to his "process" an instruction "(C) Stop". He called such a process "type 1 ... if the process it determines terminates for each specific problem." (U. p.289ff) 1937-- Alan Turing's paper On Computable Numbers With an Application to the Entscheidungsproblem reaches print in January 1937 (reprinted in U, p. 115). Turing's proof departs from calculation by recursive functions and introduces the notion of computation by machine. Stephen Kleene (1952) refers to this as one of the "first examples of decision problems proved unsolvable".
       1939 -- J.B. Rosser observes the essential equivalence of "effective method" defined by Gödel, Church, and Turing (Rosser in U p. 273, "Informal Exposition of Proofs of Gödel's Theorem and Church's Theorem").
       1943 -- In his 1943 paper Stephen Kleene states that "In setting up a complete algorithmic theory, what we do is describe a procedure ... which procedure necessarily terminates and in such manner that from the outcome we can read a definite answer, "Yes" or "No," to the question, "Is the predicate value true?"."
       1952 -- Stephen Kleene (1952) Chapter XIII ("Computable Functions") includes a discussion of the unsolvability of the halting problem for Turing machines and reformulates it in terms of machines that "eventually stop", for example halt: "... there's no algorithm for deciding whether any given machine, when started from any given situation, eventually stops." (Kleene (1952) p.382)
       1952 -- "Davis [ Martin Davis ] thinks it likely that he first used the term 'halting problem' in a series of lectures that he gave at the Control Systems Laboratory at the University of Illinois in 1952 (letter from Davis to Copeland, 12 Dec. 2001.)" (Footnote 61 in Copeland (2004) pp.40ff)

    Further Information

    Get more info on 'Halt Problem'.


    External Link Exchanges

    Do you know how hard it is to get a link from a large encyclopaedia? Well we're different and will prove it. To get a link from us just add the following HTML to your site on a relevant page:

      <a href="http://halting_problem.totallyexplained.com">Halting problem Totally Explained</a>

    Then simply click through this link from your web page. Our crawlers will verify your link, extract the title of your web page and instantly add a link back to it. If you like you can remove the words Totally Explained and embed the link in article text.
       As long as your link remains in place, we'll keep our link to you right here. Please play fair - our crawlers are watching. Your site must be closely related to this one's topic. Any kind of spamming, dubious practises or removing the link will result in your link from us being dropped and, potentially, your whole site being banned.



  • Copyright © 2007-8 totallyexplained.com | Licensed under the GNU Free Documentation License | Site Map
    This article contains text from the Wikipedia article Halting problem (History) and is released under the GFDL | RSS Version